package run.siyuan.rabbitmq.demo.producer;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import run.siyuan.common.constant.rabbitmq.Constants;

@Slf4j
@Component
public class ProducerService {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    public void sendMsg(Object message) {
        log.info("发送的消息为：{}", message.toString());
        rabbitTemplate.convertAndSend(Constants.Queue.RABBITMQ_SIYUAN_RABBITMQ_TEST_QUEUE_MESSAGE, message);
        log.info("发送完成");
    }

}
